// 组织架构相关接口
import http from '@/utils/request'

/**
 * 查询企业的部门列表
 */
export const reqGetDepartments = () => http({
  method: 'GET',
  url: '/company/department'
})

/**
 * 根据ID删除部门
 * @param {*} id 路径参数
 */
export const reqDelDepartments = id => http({
  method: 'delete',
  url: `/company/department/${id}`
})

/**
 * 获取员工简单列表
 */
export const reqGetUserSimpleList = () => http({
  method: 'get',
  url: '/sys/user/simple'
})

/**
 * 新增部门
 * @param {*} obj { code + introduce + manager + name + pid }
 */
export const reqAddDepartments = obj => http({
  method: 'post',
  url: '/company/department',
  data: obj
})

/**
 * 根据ID查询部门详情
 * @param {*} id 部门id
 */
export const reqGetDepartmentDetails = id => http({
  method: 'get',
  url: `/company/department/${id}`
})

/**
 * 根据ID修改部门详情
 * @param {*} form 请求体（要携带id）
 */
export const reqUpdateDepartmentDetails = form => http({
  method: 'put',
  url: `/company/department/${form.id}`,
  data: form
})
